package hflyeer.gitee.com.service.impl;

import hflyeer.gitee.com.dao.LogDao;
import hflyeer.gitee.com.entity.Log;
import hflyeer.gitee.com.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service("logService")
public class LogServiceImpl implements LogService {

    @Autowired
    private LogDao logDao;

    public void addSysLog(Log log) {
        log.setDoTime(new Date());
        log.setType("System");
        logDao.insert(log);
    }

    public void addOpeLog(Log log) {
        log.setDoTime(new Date());
        log.setType("Operation");
        logDao.insert(log);
    }

    public void addLoginLog(Log log) {
        log.setDoTime(new Date());
        log.setType("Login");
        logDao.insert(log);
    }

    public List<Log> getSysLog() {
        return logDao.select("System");
    }

    public List<Log> getOpeLog() {
        return logDao.select("Operation");
    }

    public List<Log> getLoginLog() {
        return logDao.select("Login");
    }
}
